<template>
	<view class="_showToast" v-show="isshow">
		<view class="_shade"></view>
		<view class="_ToastBox">
			<view class="Toast-box">
				<image v-if="icon=='yes'" class="Toast-icon" src="@/static/yes.png"></image>
				<image v-if="icon=='err'" class="Toast-icon" src="@/static/err.png"></image>
				<image v-if="icon=='info'" class="Toast-icon" src="@/static/info.png"></image>
				
				<view class="" v-if="icon=='yes'">
					<view class="Toast-title-success">扫描结果</view>
					<view class="texts">
						物料：{{text}}
					</view>
				</view>
				<view class="texts" v-else>
					{{text}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isshow:false,
				icon:'yes',
				text:''
			}
		},
		methods:{
			open(obj){
				this.icon = obj.icon
				this.text = obj.text
				this.isshow = true
				setTimeout(()=>{
					this.isshow = false
				},2000)
			}
		}
	}
</script>

<style lang="scss" scoped>
	._showToast {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		z-index: 10000;
		._shade {
			width: 100%;
			height: 100%;
			position: absolute;
			top: 0;
			left: 0;
			// background: #000;
			// opacity: .6;
			z-index: 11000;
		}
		._ToastBox {
			width: 100%;
			height: 100%;
			position: absolute;
			top: 0;
			left: 0;
			z-index: 12000;
			display: flex;
			justify-content: center;
			align-items: center;
			.Toast-box {
				position: absolute;
				width: 430rpx;
				padding: 55rpx;
				box-sizing: border-box;
				top: 50%;
				left: 50%;
				transform: translate(-50%, -50%);
				background-color: rgba(0, 0, 0, 0.8);
				box-shadow: 0px 10px 20px 0px rgba(28, 23, 47, 0.2);
				border-radius: 10rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				.Toast-icon {
					width: 120rpx;
					height: 120rpx;
					display: block;
				}
			}
			.Toast-title-success{
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #FFFFFF;
				line-height: 36rpx;
				margin-top: 36rpx;
				text-align: center;
			}
			.texts{
				text-align: center;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #FFFFFF;
				line-height: 36rpx;
				margin-top: 20rpx;
			}
		}
	}
</style>